package operation;

import result.Score;
import result.ScoreList;

import java.util.Scanner;

public class FindOperation implements IOperation{
    @Override
    public void work(ScoreList scoreList) {
        System.out.println("查找成绩！！！");
        Scanner sc=new Scanner(System.in);
        System.out.println("输入学生姓名:");
        String name=sc.nextLine();
        System.out.println("输入学生学号:");
        String studentID=sc.nextLine();
        int size=scoreList.getSize();
        for(int i=0;i<size;i++){
            Score score=scoreList.getScores(i);
            if(score.getName().equals(name)&&score.getStudentID().equals(studentID)){
                System.out.println("查找成功！");
                System.out.println("找到了此成绩，信息如下：");
                System.out.println(score);
                return;
            }
        }
        System.out.println("没有找到该学生成绩，请重新输入！");
    }
}
